From: Emmanuel Ackaouy Date: Fri, 5 Jan 2007 17:34:36 +0000 (+0000) Subject: Enable compatibility mode operation for HYPERVISOR_platformop. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15422^2~45 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=f5404d9805bc400ef5ed4d626c38828db4b662b5;p=xen.git Enable compatibility mode operation for HYPERVISOR_platformop. Signed-off-by: Jan Beulich --- diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c index 7d2ee6f496..766a357e65 100644 --- a/xen/arch/x86/platform_hypercall.c +++ b/xen/arch/x86/platform_hypercall.c @@ -23,11 +23,17 @@ #include #include "cpu/mtrr/mtrr.h" -long do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op) +#ifndef COMPAT +typedef long ret_t; +DEFINE_SPINLOCK(xenpf_lock); +#else +extern spinlock_t xenpf_lock; +#endif + +ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op) { - long ret = 0; + ret_t ret = 0; struct xen_platform_op curop, *op = &curop; - static DEFINE_SPINLOCK(xenpf_lock); if ( !IS_PRIV(current->domain) ) return -EPERM; @@ -105,8 +111,15 @@ long do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op) case XENPF_microcode_update: { extern int microcode_update(XEN_GUEST_HANDLE(void), unsigned long len); +#ifndef COMPAT ret = microcode_update(op->u.microcode.data, op->u.microcode.length); +#else + XEN_GUEST_HANDLE(void) data; + + guest_from_compat_handle(data, op->u.microcode.data); + ret = microcode_update(data, op->u.microcode.length); +#endif } break; diff --git a/xen/arch/x86/x86_64/Makefile b/xen/arch/x86/x86_64/Makefile index 5709de3694..509f442a3c 100644 --- a/xen/arch/x86/x86_64/Makefile +++ b/xen/arch/x86/x86_64/Makefile @@ -6,6 +6,7 @@ obj-y += traps.o obj-$(CONFIG_COMPAT) += compat.o obj-$(CONFIG_COMPAT) += domain.o obj-$(CONFIG_COMPAT) += physdev.o +obj-$(CONFIG_COMPAT) += platform_hypercall.o ifeq ($(CONFIG_COMPAT),y) # extra dependencies @@ -13,5 +14,6 @@ compat.o: ../compat.c entry.o: compat/entry.S mm.o: compat/mm.c physdev.o: ../physdev.c +platform_hypercall.o: ../platform_hypercall.c traps.o: compat/traps.c endif diff --git a/xen/arch/x86/x86_64/compat/entry.S b/xen/arch/x86/x86_64/compat/entry.S index d9d70a248c..792854eb83 100644 --- a/xen/arch/x86/x86_64/compat/entry.S +++ b/xen/arch/x86/x86_64/compat/entry.S @@ -278,7 +278,6 @@ CFIX14: .section .rodata, "a", @progbits -#define compat_platform_op domain_crash_synchronous #define compat_acm_op domain_crash_synchronous #define compat_xenoprof_op domain_crash_synchronous #define compat_sysctl domain_crash_synchronous diff --git a/xen/arch/x86/x86_64/platform_hypercall.c b/xen/arch/x86/x86_64/platform_hypercall.c new file mode 100644 index 0000000000..2ce7c12dc1 --- /dev/null +++ b/xen/arch/x86/x86_64/platform_hypercall.c @@ -0,0 +1,29 @@ +/****************************************************************************** + * platform_hypercall.c + * + */ + +#include +#include +#include + +DEFINE_XEN_GUEST_HANDLE(compat_platform_op_t); +#define xen_platform_op compat_platform_op +#define xen_platform_op_t compat_platform_op_t +#define do_platform_op(x) compat_platform_op(_##x) + +#define COMPAT +#define _XEN_GUEST_HANDLE(t) XEN_GUEST_HANDLE(t) +typedef int ret_t; + +#include "../platform_hypercall.c" + +/* + * Local variables: + * mode: C + * c-set-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */